<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<c:import url="/mc/common/kindeditor/jsp/kingeditorCommon.jsp?module=activity&textareaName=entity.detail"></c:import>
<div>
	<form id="infoForm" target="hiddenFrame" action="${path}/mc/activitysaveInfo" method="post" enctype="multipart/form-data">
		<input type="hidden" name="entity.id" value="${entity.id}" />
		<fieldset style="padding-left: 10px;">
			<table>
			  	<tr>
			  		<td>封面图片</td>
			  		<td>
			  			<%-- <input type="text" name="entity.coverPicId" value="<c:choose><c:when test="${empty entity.coverPicId}"></c:when><c:otherwise>${entity.coverPicId}</c:otherwise></c:choose>"
			  				class="{required:true,messages:{required:'封面图片id不能为空'}}">  --%>
			  			<c:import url="/mc/common/imgPreview.jsp?hidName=entity.coverPic.id&name=coverPic.file&imgPath=${entity.coverPic.id}&picId=${entity.coverPic.id}&index=1" />	
			  			<label style='color:#F80;'>图片建议尺寸：360*160</label>
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>活动标题</td>
			  		<td>
			  			<input type="text" name="entity.title" value="<c:choose><c:when test="${empty entity.title}"></c:when><c:otherwise>${entity.title}</c:otherwise></c:choose>"
			  				class="{required:true,messages:{required:'活动标题不能为空'}}"> 
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>机构名称</td>
			  		<td>
			  			<select name="entity.organization.id" class="searchInputAndSelect" style="width: 120px">
			  				<c:if test="${not empty organizList }">
			  					<c:forEach items="${organizList }" var="organiz">
				  					<option value="${organiz.id }" <c:if test="${organiz.id == entity.organization.id }">selected="selected"</c:if> >${organiz.name }</option>
			  					</c:forEach>
			  				</c:if>
			  			</select>
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>活动类型</td>
			  		<td>
			  			<select name="entity.activityType.id" class="searchInputAndSelect" style="width: 120px">
			  				<c:if test="${not empty activityTypeList }">
			  					<c:forEach items="${activityTypeList }" var="activityType">
				  					<option value="${activityType.id }" <c:if test="${activityType.id == entity.activityType.id }">selected="selected"</c:if> >${activityType.typeName }</option>
			  					</c:forEach>
			  				</c:if>
			  			</select>
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>大人是否需要记数</td>
			  		<td>
			  			<select id = "isAdultRecord" name="entity.isAdultRecord" dir="${entity.isAdultRecord}" >
			  			<option value="1" selected="selected">需要记数</option>
			  			<option value="0">不需要记数</option>
			  			</select>
			  		<label style='color:#F80;'>温馨提示：当大人不需要计数的时候，大人价格默认为0且不可修改！(*^__^*)</label>
			  		</td>
				</tr>
				
			  	<tr>
			  		<td>大人价格</td>
			  		<td>
			  			<input id="adultprice" type="text" name="entity.adultPrice" value="<c:choose><c:when test="${empty entity.adultPrice}"></c:when><c:otherwise>${entity.adultPrice}</c:otherwise></c:choose>"
			  				class="{required:true,number:true,messages:{required:'大人价格不能为空',number:'请输入数字'}}"> 
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>小孩价格</td>
			  		<td>
			  			<input type="text" name="entity.childPrice" value="<c:choose><c:when test="${empty entity.childPrice}"></c:when><c:otherwise>${entity.childPrice}</c:otherwise></c:choose>"
			  				class="{required:true,number:true,messages:{required:'小孩价格不能为空',number:'请输入数字'}}"> 
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>小孩年龄</td>
			  		<td>
			  			<input type="text" name="entity.ages" value="<c:choose><c:when test="${empty entity.ages}"></c:when><c:otherwise>${entity.ages}</c:otherwise></c:choose>"
			  				class="{required:true,messages:{required:'活动适合的小孩年龄不能为空'}}" placeholder="活动适合的小孩年龄,多个请用逗号隔开,例如：2,3,4,5"> 
			  		</td>
			  	</tr>
			  	<tr>
					<td>活动开始时间</td>
					<td class="right"><input name="entity.beginTimeString" type="text"
						class="timemin beginTimeClass searchInputAndSelect" readonly="readonly"
						value="<fmt:formatDate value="${entity.beginTime}"  pattern="yyyy-MM-dd HH:mm"/>" /> 
						<!--type="both"-->
					</td>
				</tr>
				<tr>
			  		<td>联系人姓名</td>
			  		<td>
			  			<input type="text" name="entity.contactPerson" value="<c:choose><c:when test="${empty entity.contactPerson}"></c:when><c:otherwise>${entity.contactPerson}</c:otherwise></c:choose>"
			  				class="{required:true,messages:{required:'联系人姓名不能为空'}}"> 
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>联系人号码</td>
			  		<td>
			  			<input type="text" name="entity.contactNum" value="<c:choose><c:when test="${empty entity.contactNum}"></c:when><c:otherwise>${entity.contactNum}</c:otherwise></c:choose>"
			  				class="{required:true,number:true,messages:{required:'联系人号码不能为空',number:'请输入数字'}}"> 
			  		</td>
			  	</tr>
			  	<%-- <tr>
			  		<td>联系地址</td>
			  		<td>
			  			<input type="text" name="entity.contactAddress" value="<c:choose><c:when test="${empty entity.contactAddress}"></c:when><c:otherwise>${entity.contactAddress}</c:otherwise></c:choose>"
			  				class="{required:true,messages:{required:'联系地址不能为空'}}"> 
			  		</td>
			  	</tr> --%>
			  	<tr>
			  		<td>活动地址</td>
			  		<td>
			  			<input type="text" name="entity.activityAddress" value="<c:choose><c:when test="${empty entity.activityAddress}"></c:when><c:otherwise>${entity.activityAddress}</c:otherwise></c:choose>"
			  				class="{required:true,messages:{required:'活动地址不能为空'}}"> 
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>活动地址位置</td>
			  		<td>
			  			<c:import url="/mc/map.jsp?companyName=${entity.organization.name}&address=${entity.activityAddress}&lng=${entity.activityAddressLon}&lat=${entity.activityAddressLat}" />
			  			<%-- <input type="text" name="entity.activityAddressLocation" value="<c:choose><c:when test="${empty entity.activityAddressLocation}"></c:when><c:otherwise>${entity.activityAddressLocation}</c:otherwise></c:choose>"> --%>
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>活动地址经度</td>
			  		<td>
			  			<input type="text" id="txtLng" class="{required:true,number:true,messages:{required:'请填写经度',number:'请填写数字'}}"
			  			name="entity.activityAddressLon" value="${entity.activityAddressLon}">
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>活动地址纬度</td>
			  		<td>
			  			<input type="text" id="txtLat" class="{required:true,number:true,messages:{required:'请填写经度',number:'请填写数字'}}"
			  			name="entity.activityAddressLat" value="${entity.activityAddressLat}">
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>活动详情</td>
			  		<td>
			  			<!-- <label style='color:#F80;'>详情中图片建议尺寸：345*240</label> -->
			  			<textarea name="entity.detail" rows="5" cols="80" style="width: 100%;height: 400px;visibility: hidden;">${entity.detail}</textarea>
			  		</td>
			  	</tr>
			  	<tr>
			  		<td>限制报名人数</td>
			  		<td>
			  			<input type="text" name="entity.joinLimitCount" value="<c:choose><c:when test="${empty entity.joinLimitCount}"></c:when><c:otherwise>${entity.joinLimitCount}</c:otherwise></c:choose>"
			  				class="{required:true,number:true,messages:{required:'限制报名人数不能为空',number:'请输入数字'}}"> 
			  		</td>
			  	</tr>
		   </table>
		</fieldset>
	</form>
</div>

<script type="text/javascript">
	$(function(){
		$("#isAdultRecord").change(function(){
			//不需要记数，为避免价格空值，大人价格默认为0
			if($(this).val() === "0") {
				$("#adultprice").attr("readonly","readonly");
				$("#adultprice").attr("style","background-color:#D8D8D8");
				$("#adultprice").val("0.0");
			} else{
				$("#adultprice").removeAttr("readonly");
				$("#adultprice").removeAttr("style");
			}
		});
		
});
</script>
